﻿using System.Data.Entity.ModelConfiguration;
using ModelLayer;

namespace DataLayer.Configurations
{
    public class ProductConfig : EntityTypeConfiguration<Product>
    {

        public ProductConfig()
        {
            HasKey(x => x.ProductId);

            HasOptional(x => x.Category).WithMany(x => x.Products).HasForeignKey(x => x.CategoryId);
            Property(x => x.Weight).HasPrecision(10, 3);

            ToTable("Product");
        }
    }
}
